package com.nashuju.web.service.sys;

import org.durcframework.core.expression.ExpressionQuery;
import org.durcframework.core.expression.subexpression.ValueExpression;
import org.durcframework.core.service.CrudService;
import org.springframework.stereotype.Service;

import com.nashuju.web.dao.sys.SysClassDao;
import com.nashuju.web.entity.sys.SysClass;

@Service
public class SysClassService extends CrudService<SysClass, SysClassDao> {

    /**
     * 判断是否有子节点
     * @param sysRes
     * @return
     */
    public boolean hasChild(SysClass sysClass) {
        ExpressionQuery query = new ExpressionQuery();
        query.add(new ValueExpression("parent_id", sysClass.getScId()));
        int count = this.findTotalCount(query);
        return count > 0;
    }

}
